﻿using LayeredSkin.Controls;
using LayeredSkin.DirectUI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Top_Meeting.UI;

namespace Top_Meeting.Window
{
    public partial class Frm_Contact_Delete : Top_Meeting.Window.Frm_Base
    {
        private string confrimMsg = "是否删除?";
        private List<string> deleteAccounts;

        public Frm_Contact_Delete()
        {
            deleteAccounts = Configuration.DeleteAccountList;
            InitializeComponent();
            FrmInit();
        }

        #region OVERRIDE_METHOD


        protected override void OnLoad(EventArgs e)
        {
            UpdateListBox(layListBox_DeleteAccounts, deleteAccounts);

            base.OnLoad(e);
        }

        protected override void UpdateLayout()
        {
            base.UpdateLayout();

            this.BackColor = Color.Transparent;

            this.AutoSize = true;

            layPanel_Body.Dock = DockStyle.None;
            layPanel_Body.ImageToBackground("img_5002_n");
            layPanel_Body.SizeToBG();

            layPanel_Icon.ImageToBackground("img_5001_n");
            layPanel_Icon.SizeToBG();
            layPanel_Icon.AlignControl(AlignType.Horizontal, AnchorStyles.None, Point.Empty);

            layListBox_DeleteAccounts.AutoSize = true;
            layListBox_DeleteAccounts.AlignControl(AlignType.Horizontal, AnchorStyles.None, Point.Empty);

            layLab_DeleteTip.Text = confrimMsg;
            layLab_DeleteTip.AlignControl(AlignType.Horizontal, AnchorStyles.None, Point.Empty);


            layBtn_Confrim.ImageToButtonImage("button_5001");
            layBtn_Confrim.AlignControl(AlignType.Horizontal, AnchorStyles.None, Point.Empty);

            layBtn_Cancel.ImageToButtonImage("button_3011");
            layBtn_Cancel.Hide();
            //layBtn_Cancel.AlignControl(AlignType.Bottom | AlignType.Horizontal, AnchorStyles.None, new Point(0, -60));
        }

        protected override void InitEvent()
        {
            base.InitEvent();

            layBtn_Confrim.Click += (o, e) => { DialogResult = DialogResult.OK; Close(); };

            layBtn_Cancel.Click += (o, e) => { DialogResult = DialogResult.Cancel; Close(); };
        }

        #endregion


        #region PRIVATE_METHOD

        private void UpdateListBox(LayeredListBox _llb, List<string> _args)
        {
            DuiLabel _dlab = new DuiLabel();

            for (int i = 0; i < _args.Count; i++)
            {
                _dlab = new DuiLabel();
                _dlab.Width = _llb.Width;
                _dlab.Height = 22;
                _dlab.Text = _args[i];
                _dlab.TextAlign = ContentAlignment.MiddleLeft;
                _dlab.Font = TMFont.GetFont("微软雅黑 Light", 12);
                _dlab.ForeColor = Color.White;
                _llb.Items.Add(_dlab);
            }
            _llb.RefreshList();
        }

        #endregion
    }
}
